import { createApp } from "vue";
import pinia from "./stores";
import ElementPlus from "element-plus";
import zhCn from "element-plus/es/locale/lang/zh-cn";
import "element-plus/dist/index.css";
import App from "./App.vue";
import router from "./router";
import "./styles/index.scss";
import ElSvg from "./components/SvgIcon/ElSvg";
// import * as ElementPlusIconVue from "@element-plus/icons-vue";
import "./permission";
import premissionDirective from "./directives/premission";
import MyPremission from "@/components/MyPremission/index.vue";
import MyButton from "@/components/MyButton/index.vue";

const app = createApp(App);
// for (const [key, component] of Object.entries(ElementPlusIconVue)) {
//   app.component(key, component);
// }
ElSvg(app);

// 注册一个全局的指令
app.directive("premission", premissionDirective);

// 注册一个全局的 my-premission 组件
app.component("my-premission", MyPremission);

app.component("my-button", MyButton);

app
  .use(pinia)
  .use(router)
  .use(ElementPlus, {
    locale: zhCn,
  })
  .mount("#app");
